package com.llt.springcloud.controller;

import com.llt.springcloud.pojo.Dept;
import com.llt.springcloud.service.DeptClientSerevice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@RestController
public class DeptConsumerController {
    //消费者不应该有server层
    @Autowired
    private DeptClientSerevice deptClientSerevice;
    @PostMapping("/consumer/dept/add")
    public boolean add(Dept dept){
        return deptClientSerevice.addDept(dept);
    }
    @GetMapping("/consumer/dept/getById/{id}")
    public Dept get(@PathVariable("id") Long id){
        return deptClientSerevice.queryById(id);
    }
    @GetMapping("/consumer/dept/list")
    public List<Dept> getDeptAll(){
        return deptClientSerevice.queryAll();
    }
}
